
package com.dongrj.framework.starter.sms;


import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.Objects;

@Setter
@Getter
@ToString
public class SmsResponse implements Serializable {
    //0.失败 1.成功
    private Integer code;
    private String message;

    public static SmsResponse success() {
        SmsResponse smsResponse = new SmsResponse();
        smsResponse.setCode(1);
        return smsResponse;
    }

    public static SmsResponse fail() {
        SmsResponse smsResponse = new SmsResponse();
        smsResponse.setCode(0);
        return smsResponse;
    }

    public boolean isSuccess() {
        return Objects.equals(this.code, 1);
    }

    public boolean isFail() {
        return Objects.equals(this.code, 0);
    }

}
